
export const walk = (treeNodes: any[], callback: Function, deep = 0, childFieldName = 'children') => {
    treeNodes.forEach((node) => {
        callback(node, deep);
        if (node[childFieldName]) {
            walk(node[childFieldName], callback, deep + 1, childFieldName);
        }
    });
};

